﻿#pragma once

// 1. 添加引用  LibBase
// 2. 添加 LibBase  的 include path
// 3. C++ 设置为 C++17
// 4. 使用多字节字符集
// 5. 不使用预编译头
// 6. hlsl文件 不参与生成
// 7. /utf-8


// 此demo尝试封装一个简单的渲染过程
// 用来绘制 A B C 三个Mesh

#include "BaseApp.h"
#include "Transform.h"
#include "framework.h"
#include "Demo1.h"
#include <iostream>
#include "WinFunc.h"
#include "BaseApp.h"
#include <vector>

#include "geo/Cube.h"
#include "geo/Sphere.h"
#include "geo/Prism.h"
#include "geo/Plane.h"
#include "geo/Cone.h"

#include "math/bMath.h"
#include "GameObject.h"
#include "MeshData.h"
#include "VertexShader.h"
#include "PixelShader.h"
#include "SysBase.h"

using namespace Base;

struct MVPBuffer {
	Matrix4x4 worldMat;
	Matrix4x4 viewMat;
	Matrix4x4 projMat;
};


class Demo1 :public BaseApp {

public:
	virtual void OnResize() override;
	virtual void OnInit() override;
	virtual void OnGUI() override;
	virtual void OnInput() override;
	virtual void OnUpdate() override;
	virtual void OnFrame() override;
	virtual void OnTerminate() override;
private:

	// 0
	std::shared_ptr<VertexShader> m_vertexShader0;
	std::shared_ptr<PixelShader> m_pixelShader0;

	// 1
	std::shared_ptr<VertexShader> m_vertexShader1;
	std::shared_ptr<PixelShader> m_pixelShader1;

	//objs
	std::vector<std::shared_ptr<GameObject>> m_objs;

	// mesh
	MeshData m_meshData0, m_meshData1;

	// constant buffer
	ComPtr<ID3D11Buffer> m_mvpBuffer;
	ComPtr<ID3D11Buffer> m_uColorBuffer;
	Vec4 m_color;
	MVPBuffer m_mvpBufferData;
};







